Ext.namespace('RestHandler');

RestHandler.create = function(config){
    Ext.Ajax.request({
       url: config.url
       ,success: config.success
       ,failure: config.failure
       ,headers: {
           'content-type': 'text/xml'
       }
       ,method: 'post'
       ,xmlData: config.resourceXml
    });
};

RestHandler.read = function(config){
    Ext.Ajax.request({
       url: config.url
       ,success: config.success
       ,failure: config.failure
       ,method: 'get'
       ,xmlData: config.resourceXml
    });
};

RestHandler.update = function(config){
    Ext.Ajax.request({
       url: config.url
       ,success: config.success
       ,failure: config.failure
       ,headers: {
           'content-type': 'text/xml'
       }
       ,method: 'put'
       ,xmlData: config.resourceXml
    });
};


RestHandler.delete = function(config){
    Ext.Ajax.request({
       url: config.url
       ,success: config.success
       ,failure: config.failure
       ,method: 'delete'
    });
};
